import { createRequest } from '/@/api/service';
const module = 'ib/visitor/v1/VisitorAppointmentOpenApi/open';

/**
 * @function 提交访客登记-访客自主登记二维码入口
 * @param data
 * @param header
 * @returns {Promise}
 */
function INSERT_VISITOR_APPOINTMENT_BY_QRCODE(
  data: VisitorAppointmentOpenApi.InsertVisitorAppointmentByQrcodeReq,
  header: object = {},
): Promise<VisitorAppointmentOpenApi.InsertVisitorAppointmentByQrcodeResp> {
  return createRequest(
    `${process.env.APP_API_URL}${module}/insertVisitorAppointmentByQrcode`,
    data,
    header,
    'POST',
  );
}

/**
 * @function 检查访客自主登记二维码
 * @param data
 * @param header
 * @returns {Promise}
 */
function CHECK_QRCODE(
  data: VisitorAppointmentOpenApi.CheckQrcodeReq,
  header: object = {},
): Promise<VisitorAppointmentOpenApi.CheckQrcodeResp> {
  return createRequest(`${process.env.APP_API_URL}${module}/checkQrcode`, data, header, 'POST');
}

/**
 * @function 查看访客邀请详情-返回数据为登录者提交的
 * @param data
 * @param header
 * @returns {Promise}
 */
function MY_DETAIL(
  data: VisitorAppointmentApi.MyDetailReq,
  header: object = {},
): Promise<VisitorAppointmentApi.MyDetailResp> {
  return createRequest(`${process.env.APP_API_URL}${module}/myDetail`, data, header, 'POST');
}

export { INSERT_VISITOR_APPOINTMENT_BY_QRCODE, CHECK_QRCODE, MY_DETAIL };
